<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/public/header.jsp"%>
<%
	Map<String, Object> sessionMap = (Map<String, Object>) session.getAttribute("LOGIN_USER");
	String dept_id=String.valueOf(sessionMap.get("dept_id"));
%>
<html>
	<head>
		<title>部门账户管理</title>
	</head>
	<script type="text/javascript">
		$(function(){
			$("#table").datagrid({
				title:"部门账户管理",
				iconCls:'icon-edit',
				loadMsg:'正在加载数据，请稍后......',
				url:'<%=contextPath %>/springMVC/finance/listPageFinanceDept?dept_id=<%=dept_id%>',
				rownumbers:true,
				fitColumns:true,
				singleSelect:true,
				nowrap:false,
				idField:'id',
				frozenColumns:[[
				    {title:'主键',field:'id',hidden:true}
				]],
				columns:[[
					{title:'部门',field:'dept_name',width:200,align:'center'},
					{title:'金额',field:'money',width:100,align:'center'},
					{title:'往来明细',field:'details',fit:true,width:50,align:'center',formatter:function(value,rowDate,rowIndex){
						return "<input type='button'  style='border:0px #ff0000 solid;width:25px;height:15px;cursor:pointer'class='icon-details'  onClick='showDetails(\""+rowDate.id+"\")'/>";
					}}
				]],
				pageSize:10,
				pageList : [10,50,100],  
				pagination:true,
				onLoadSuccess:function(rtJson){
					if(rtJson.rtState== '1')
					{
						$.messager.alert('提示',rtJson.rtMsrg);
					}
				}
			});
		});
		
		function rtCallBack(){
			$('#table').datagrid('reload');
		}
		function addOrEditFinanceDept(){
				openDialogResize("<%=contextPath %>/springViews/finance/addOrEditFinanceDept.jsp?callback=rtCallBack",1000, 800);
		}
		function showDetails(id){
			openDialogResize('<%=contextPath %>/springViews/gd/financeDeptLog.jsp?finance_dept_id='+id,1000, 800);
		}
	</script>
	<body>
		<div id="table"></div>
	</body>
</html>
